﻿@model List<DMS.Models.CategoryObject>
@{
    Layout = null;
}
<h4>Danh mục tài liệu</h4>
<div id='cssmenu' style="padding-top:20px">
    <ul>
        @{
            int catId = Request.Params["catId"] == null ? 0 : Convert.ToInt32(Request.Params["catId"]);
            foreach (var item1 in Model)
            {
                <li class="@if(item1.CategoryChild.Count>0){<text>active has-sub</text>}">
                    <a href='/?catId=@item1.CategoryId'><span>@item1.CategoryName</span></a>
                    @if (item1.CategoryChild.Count > 0)
                    {
                        <ul class="@if(catId==item1.CategoryParentId){<text>display:block</text>}">
                            @foreach (var item2 in item1.CategoryChild)
                            {
                                <li class="@if(item2.CategoryChild.Count>0){<text>active has-sub</text>}">
                                    <a href='/?catId=@item2.CategoryId'><span>@item2.CategoryName</span></a>
                                    @if (item2.CategoryChild.Count > 0)
                                    {
                                        <ul class="@if(catId==item2.CategoryParentId){<text>display:block</text>}">
                                            @foreach (var item3 in item2.CategoryChild)
                                            {
                                                <li class="@if(item3.CategoryChild.Count>0){<text>active has-sub</text>}">
                                                    <a href='/?catId=@item3.CategoryId'><span>@item3.CategoryName</span></a>
                                                </li>
                                            }
                                        </ul>
                                    }
                                </li>
                            }
                        </ul>
                    }
                </li>
            }
        }
    </ul>
</div>
